<script>
	import config from './config'
	import { getToken } from '@/utils/auth'
	export default {
		globalData: {
			config: config
		},
		onLaunch: function() {
			initApp()
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}

	async function initApp() {
		// 检查用户登录状态
		//#ifdef H5
		checkLogin()
		//#endif
	}

	function checkLogin() {
		if (!getToken()) {
			uni.reLaunch({ url: '/pages/login' })
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import '@/static/scss/index.scss';
</style>